*"Dixie's Drivers: Core Values and the Southern Republican Realignment*

*This project analyzes the sources of partisan change among southerners*
*and non-southerners from 1988 to 2016*
*Our specific endeavor is to assess the role of core values in the great*
*Southern Republican realignment*
*This project was conducted collaboratively with Seth C. McKee of Texas*
*Tech University*

*This Stata do file features code used to analyze the American National* 
*Election Studies (ANES) Cumulative File (1948-2016) and data merged with the* 
*2016 ANES*

*This Stata do file corresponds to the final manuscript accepted* 
*for publication in the Journal of Politics*

*Wed. 13 September 2017*
*Friday 22 December 2017*
*Sat. 23 December 2017*
*Sun. 24 December 2017*
*Mon. 25 December 2017*
*Sat. 27 January 2018*
*Sun. 28 January 2018*
*Thurs. 1 February 2018*
*Friday 2 February 2018*
*Saturday 2 February 2018*
*Tues. 6 February 2018*
*Wed. 7 February 2018*
*Thurs. 7 February 2018*
*Friday 8 February 2018*
*Sat. 9 February 2018*
*Wed. 3 October 2018*
*Thurs. 4 October 2018*
*Friday 5 October 2018*
*Sun. 7 October 2018*
*Mon. 8 October 2018*
*Tues. 9 October 2018*
*Wed. 10 October 2018*
*Thurs. 11 October 2018*
*Wed. 28 November 2018*
*Thurs. 24 January 2019*
*Friday 25 January 2019*

***************
*This analysis first requires that the researcher download the ANES Cumulative*
*File (1948-2012), which is saved as the following Stata Data* 
*file: "ANES Cumulative File (1948-2012).dta"*
****************

set more off
set matsize 10000
keep if VCF0004 > 1986
drop if VCF0004 == 1990 
drop if VCF0004 == 1994
drop if VCF0004 == 1996
drop if VCF0004 == 1998
drop if VCF0004 == 2002

****************
*Recode demographic control variables*

*Note: These variables will be included as control variables in the* 
*empirical analysis predicting partisanship*
****************

*Note: Our empirical analysis throughout this entire manuscript will focus*
*exclusively on whites given our goal to understand whites' partisan change*
*during this period*

*Race*

gen White = .
replace White = 1 if VCF0105a == 1
label var White ///
"White"
label define Whites ///
0 "Non-white" 1 "Whites" 
label values White Whites

keep if White == 1

*Gender*

gen Gender = VCF0104
replace Gender = . if VCF0104 == 0
replace Gender = 0 if VCF0104 == 1
replace Gender = 1 if VCF0104 == 2
label var Gender ///
"Respondent Gender"
label define Sex 0 "0 Male" 1 "1 Female"
label values Gender Sex

*Age*

gen Age = VCF0101
replace Age = . if VCF0101 == 00
replace Age = . if VCF0101 == 97
replace Age = . if VCF0101 == 99
label var Age "Respondent Age"

*Education*

gen Education = VCF0110
replace Education = . if VCF0110 == 0
label var Education ///
"Respondent's Education"
label define Educationlevel ///
1 "1 Less than high school" 2 "2 High school diploma" 3 "3 Some college" ///
4 "4 College or advanced degree"
label values Education Educationlevel

*Income*

gen Income = VCF0114
replace Income = . if VCF0114 == 0

****************
*Recode the region variable*

*Note: For the empirical analysis, "South" will be compared to the*
*other regions (identified as "East," "Midwest" and "West," respectively)*

*Note: "South" is defined as the eleven states of the former Confederacy,*
*Alabama, Arkansas, Georgia, Florida, Louisiana, Mississippi, North Carolina,* 
*South Carolina, Tennessee, Texas and Virginia*
****************

*South*

gen South = .
replace South = 0 if VCF0113 == 2
replace South = 1 if VCF0113 == 1

label var South ///
"South Region Dummy"
label define Southern ///
0 "0 Non-South" 1 "1 South"
label values South Southern

****************
*Recode symbolic predispositions*
****************

*Party identification*

*Note: Partisanship runs from "strong Democrat" (0)* 
*to "strong Republican" (6), and thus 3 represents true political independents*

gen Partyid = VCF0301
replace Partyid = . if VCF0301 == 0
replace Partyid = 0 if VCF0301 == 1
replace Partyid = 1 if VCF0301 == 2
replace Partyid = 2 if VCF0301 == 3
replace Partyid = 3 if VCF0301 == 4
replace Partyid = 4 if VCF0301 == 5
replace Partyid = 5 if VCF0301 == 6
replace Partyid = 6 if VCF0301 == 7
label var Partyid ///
"Party Identification"

*Ideology*
*Note: Ideology runs from "extremely liberal" (0) to "extremely conservative"* 
*(6), and thus 3 represents ideological moderates*

gen Ideology = VCF0803
replace Ideology = . if VCF0803 == 0
replace Ideology = . if VCF0803 == 9
replace Ideology = 0 if VCF0803 == 1
replace Ideology = 1 if VCF0803 == 2
replace Ideology = 2 if VCF0803 == 3
replace Ideology = 3 if VCF0803 == 4
replace Ideology = 4 if VCF0803 == 5
replace Ideology = 5 if VCF0803 == 6
replace Ideology = 6 if VCF0803 == 7
label var Ideology ///
"Ideological Self-Identification"

*Recode ideology to range from "0" to "1"*

*Note: The variable is coded as such so that all primary predictors*
*of interest range from zero to one, enabling a clear comparison* 
*of effects*

replace Ideology = Ideology/6

****************
*Recode racial resentment variables*

*Note: We will create all scales, namely, the racial resentment, religiosity,* 
*social welfare issues,egalitarianism and moral traditionalism scales,* 
*after we merge these data with the 2016 ANES data*
****************

*Conditions have made it difficult for blacks to succeed*

gen Conditionsblack = VCF9039
replace Conditionsblack = . if VCF9039 == 8
replace Conditionsblack = . if VCF9039 == 9
replace Conditionsblack = 0 if VCF9039 == 1
replace Conditionsblack = 1 if VCF9039 == 2
replace Conditionsblack = 2 if VCF9039 == 3
replace Conditionsblack = 3 if VCF9039 == 4
replace Conditionsblack = 4 if VCF9039 == 5

*The "Conditonsblack" variable is coded as follows:*

*0 = Agree strongly*
*1 = Agree somewhat*
*2 = Neither agree nor disagree*
*3 = Disagree somewhat*
*4 = Disagree strongly*

*Blacks should get ahead without any special favors*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative attitudes*

gen Blacksspecial = VCF9040
replace Blacksspecial = . if VCF9040 == 8
replace Blacksspecial = . if VCF9040 == 9
replace Blacksspecial = 0 if VCF9040 == 5
replace Blacksspecial = 1 if VCF9040 == 4
replace Blacksspecial = 2 if VCF9040 == 3
replace Blacksspecial = 3 if VCF9040 == 2
replace Blacksspecial = 4 if VCF9040 == 1

*The "Blacksspecial" variable is coded as follows:*

*0 = Disagree strongly*
*1 = Disagree somewhat*
*2 = Neither agree nor disagree*
*3 = Agree somewhat*
*4 = Agree strongly*

*Blacks could succeed if they would try harder*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative attitudes*

gen Blackstry = VCF9041
replace Blackstry = . if VCF9041 == 8
replace Blackstry = . if VCF9041 == 9
replace Blackstry = 0 if VCF9041 == 5
replace Blackstry = 1 if VCF9041 == 4
replace Blackstry = 2 if VCF9041 == 3
replace Blackstry = 3 if VCF9041 == 2
replace Blackstry = 4 if VCF9041 == 1

*The "Blackstry" variable is coded as follows:*

*0 = Disagree strongly*
*1 = Disagree somewhat*
*2 = Neither agree nor disagree*
*3 = Agree somewhat*
*4 = Agree strongly*

*Blacks have gotten less than they deserve*

gen Blacksgotless = VCF9042
replace Blacksgotless = . if VCF9042 == 8
replace Blacksgotless = . if VCF9042 == 9
replace Blacksgotless = 0 if VCF9042 == 1
replace Blacksgotless = 1 if VCF9042 == 2
replace Blacksgotless = 2 if VCF9042 == 3
replace Blacksgotless = 3 if VCF9042 == 4
replace Blacksgotless = 4 if VCF9042 == 5

*The "Blacksgotless" variable is coded as follows:*

*0 = Agree strongly*
*1 = Agree somewhat*
*2 = Neither agree nor disagree*
*3 = Disagree somewhat*
*4 = Disagree strongly*

****************
*Recode the retrospective economic evaluations variable*
*Note: This economic evaluations measure will be included as a control variable*
*in the model predicting partisanship*
****************

*Retrospective economic evaluations (one year)*

*Note: The unlabeled category is ".5," which is unlabeled due to the fact that*
*STATA does not allow non-integer value labels*

*Note: The variable is coded such that all primary predictors*
*of interest range from zero to one, enabling a clear comparison* 
*of effects*

gen Retrospective = VCF0870
replace Retrospective = . if VCF0870 == 8
replace Retrospective = 0 if VCF0870 == 5
replace Retrospective = .5 if VCF0870 ==3
label var Retrospective ///
"Evaluation of the Economy over the Past Year"
label define Retrospectives ///
0 "0 Worse" 1 "1 Better"
label values Retrospective Retrospectives 

****************
*Religiosity*

*Specifically, we follow Layman (1997) by creating a two-item scale of* 
*religiosity using the ANES biblical literalism and frequency of church* 
*attendance measures*
****************

*Biblical literalism*
*Note: This variable is reverse coded such that higher values indicate greater*
*greater religiosity*

*Note: The series for ANES Cumulative File variable VCF0845 was discontinued* 
*after 1988, meaning that this variable is constructed from both VCF0845 and*
*VCF0850 for the years 1992-2012*

*Note: The number of response categories differ across the two variables,* 
*which is why the two most liberal categories are combined in 1988*

gen Biblit = .
replace Biblit = 0 if VCF0845 == 3 & VCF0004 == 1988
replace Biblit = 0 if VCF0845 == 4 & VCF0004 == 1988
replace Biblit = 0 if VCF0850 == 3
replace Biblit = 1 if VCF0850 == 2
replace Biblit = 1 if VCF0845 == 2 & VCF0004 == 1988
replace Biblit = 2 if VCF0845 == 1 & VCF0004 == 1988
replace Biblit = 2 if VCF0850 == 1
label var Biblit "Biblical Literalism"

*Note: The categories for the biblical literalism variable in 1988 (VCF0845)* 
*are as follows*

*0 "The Bible was written by men who lived so long ago that it is worth very little today"
*0 "The Bible is a good book because it was written by wise men, but God had nothing to do with it"
*1 "The Bible was written by men inspired by God but it contains some human errors"
*2 "The Bible is God's word and all that it says is true"

*Note: The categories for the biblical literalism variable for the years* 
*1992-2012 (VCF0850) are as follows:*

*0 "The Bible is a book written by men and is not the word of God"
*1 "The Bible is the word of God but not everything in it should be taken literally, word for word"
*2 "The Bible is the actual word of God and is to be taken literally, word for word"

*Recode the biblical literalism variable to range between 0 and 1*

replace Biblit = Biblit/2

*Note: The variable is coded such that the eventual religiosity scale will*
*range from 0 to 1, meaning that all primary predictors of interest range* 
*from zero to one, enabling a clear comparison of effects*

*Church attendance*
*Note: This variable is reverse coded so that higher values indicate greater*
*greater religiosity*

gen Churchattend = VCF0130
replace Churchattend = . if VCF0130 == 0
replace Churchattend = . if VCF0130 == 7
replace Churchattend = . if VCF0130 == 8
replace Churchattend = . if VCF0130 == 9
replace Churchattend = 0 if VCF0130 == 5
replace Churchattend = 1 if VCF0130 == 4
replace Churchattend = 2 if VCF0130 == 3
replace Churchattend = 3 if VCF0130 == 2
replace Churchattend = 4 if VCF0130 == 1
label var Churchattend "Church Attendance"

*Note: The categories for the church attendance variable are as follows*

*0 "Never"
*1 "A few times a year" 
*2 "Once or twice a month"
*3 "Almost every week"*
*4 "Every week"

*Recode the Church attendance variable to range between 0 and 1*

replace Churchattend = Churchattend/4

*Note: The variable is coded such that the eventual religiosity scale will*
*range from 0 to 1, meaning that all primary predictors of interest range* 
*from zero to one, enabling a clear comparison of effects*

****************
*Recode values variables*

*Note: The eight individual questions comprising the two longest running ANES* 
*batteries of core values, egalitarianism (four questions) and moral* 
*traditionalism (four questions), will be combined into a single scale*
*ranging from zero to one in this analysis*

*Note: The resulting scale will serve as the primary independent variable* 
*of interest in the empirical analysis testing the potentially changing* 
*over time influence of region on the relationship* 
*between individuals' egalitarian postures and partisanship*

*Note: The ANES egalitarianism battery was unfortunately reduced from six*
*questions to four in 2016 after containing the same six questions in every*
*presidential election year from 1988 through 2012 (you're silly, ANES!)*
****************

****************
*Recode egalitarianism variables*

*Note: The equal opportunity, unequal variables and less equal variables* 
*are all reverse coded so that higher values indicate* 
*more conservative values*
****************

*Do whatever is necessary for equal opportunity*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative values*

gen Equalopp = VCF9013
replace Equalopp = . if VCF9013 == 8 
replace Equalopp = . if VCF9013 == 9
replace Equalopp = 0 if VCF9013 == 1
replace Equalopp = 1 if VCF9013 == 2
replace Equalopp = 2 if VCF9013 == 3
replace Equalopp = 3 if VCF9013 == 4
replace Equalopp = 4 if VCF9013 == 5
label var Equalopp /// 
"Our Society Should Do What is Necessary to Ensure Equal Opportunity"
label define Equalopportunity ///
0 "0 Agree strongly" 1 "1 Agree somewhat" ///
2 "2 Neither agree nor disagree" 3 "3 Disagree somewhat" 4 "4 Disagree strongly"
label values Equalopp Equalopportunity

*Not that big of a problem if people have more of a chance*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative values*

gen Unequal = VCF9016
replace Unequal = . if VCF9016 == 8
replace Unequal = . if VCF9016 == 9
replace Unequal = 0 if VCF9016 == 5 
replace Unequal = 1 if VCF9016 == 4 
replace Unequal = 2 if VCF9016 == 3 
replace Unequal = 3 if VCF9016 == 2 
replace Unequal = 4 if VCF9016 == 1 
label var Unequal /// 
"It Is Not That Big of a Problem if Some People Have More of a Chance in Life"
label define Unequalchance ///
0 "0 Disagree strongly" 1 "1 Disagree somewhat" ///
2 "2 Neither agree nor disagree" 3 "3 Agree somewhat" 4 "4 Agree strongly"
label values Unequal Unequalchance

*Better off if we worried less about equality*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative values*

gen Lessequal = VCF9017
replace Lessequal = . if VCF9017 == 8
replace Lessequal = . if VCF9017 == 9
replace Lessequal = 0 if VCF9017 == 5
replace Lessequal = 1 if VCF9017 == 4
replace Lessequal = 2 if VCF9017 == 3
replace Lessequal = 3 if VCF9017 == 2
replace Lessequal = 4 if VCF9017 == 1
label var Lessequal ///
"This Country Would Be Better Off if We Worried Less about Equality"
label define Lessequality ///
0 "0 Disagree strongly" 1 "1 Disagree somewhat" /// 
2 "2 Neither agree nor disagree" 3 "3 Agree somewhat" 4 "4 Agree strongly"
label values Lessequal Lessequality

*Many fewer problems if people were treated equally*

gen Fewer = VCF9018
replace Fewer = . if VCF9018 == 8
replace Fewer = . if VCF9018 == 9
replace Fewer = 0 if VCF9018 == 1
replace Fewer = 1 if VCF9018 == 2
replace Fewer = 2 if VCF9018 == 3
replace Fewer = 3 if VCF9018 == 4
replace Fewer = 4 if VCF9018 == 5
label var Fewer /// 
"If People Were Treated More Equally in this Country We Would Have Many Fewer Problems"
label define Treatequally ///
0 "0 Agree strongly" 1 "1 Agree somewhat" ///
2 "2 Neither agree nor disagree" 3 "3 Disagree somewhat" 4 "4 Disagree strongly"
label values Fewer Treatequally

****************
*Recode moral traditionalism variables*

*Note: The lifestyles and family variables are reverse coded so that higher* 
*values indicate more conservative values*
****************

*Newer lifestyles contributing to a breakdown in society*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative values*
 
gen Lifestyles = VCF0851
replace Lifestyles = . if VCF0851 == 8
replace Lifestyles = . if VCF0851 == 9
replace Lifestyles = 0 if VCF0851 == 5
replace Lifestyles = 1 if VCF0851 == 4
replace Lifestyles = 2 if VCF0851 == 3
replace Lifestyles = 3 if VCF0851 == 2
replace Lifestyles = 4 if VCF0851 == 1
label var Lifestyles /// 
"Newer Lifestyles are Contributing to the Breakdown of Society"
label define Lifestylesnew ///
0 "0 Disagree strongly" 1 "1 Disagree somewhat" /// 
2 "2 Neither agree nor disagree" 3 "3 Agree somewhat" 4 "4 Agree strongly"
label values Lifestyles Lifestylesnew

*Adjusting views of moral behavior*

gen Changing = VCF0852
replace Changing = . if VCF0852 == 8
replace Changing = . if VCF0852 == 9
replace Changing = 0 if VCF0852 == 1
replace Changing = 1 if VCF0852 == 2
replace Changing = 2 if VCF0852 == 3
replace Changing = 3 if VCF0852 == 4
replace Changing = 4 if VCF0852 == 5
label var Changing /// 
"We Should Adjust our Views of Moral Behavior to Changes in Society"
label define Changingmorals 0 "Agree strongly" 1 "Agree somewhat" /// 
2 "Neither agree nor disagree" 3 "Disagree somewhat" 4 "Disagree strongly"
label values Changing Changingmorals

*More emphasis on traditional family ties*
*Note: This variable is reverse coded so that higher values indicate* 
*more conservative values*
 
gen Family = VCF0853
replace Family = . if VCF0853 == 8
replace Family = . if VCF0853 == 9
replace Family = 0 if VCF0853 == 5
replace Family = 1 if VCF0853 == 4
replace Family = 2 if VCF0853 == 3
replace Family = 3 if VCF0853 == 2
replace Family = 4 if VCF0853 == 1
label var Family /// 
"This Country Would Have Many Fewer Problems if There Were More Emphasis on Traditional Family Ties"
label define Familyties /// 
0 "0 Disagree strongly" 1 "1 Disagree somewhat" /// 
2 "2 Neither agree nor disagree"  3 "3 Agree somewhat" 4 "4 Agree strongly"
label values Family Familyties
 
*Tolerant of people who choose to live according to their own moral standards*

gen Standards = VCF0854
replace Standards = . if VCF0854 == 8
replace Standards = . if VCF0854 == 9
replace Standards = 0 if VCF0854 == 1
replace Standards = 1 if VCF0854 == 2
replace Standards = 2 if VCF0854 == 3
replace Standards = 3 if VCF0854 == 4
replace Standards = 4 if VCF0854 == 5
label var Standards /// 
"More Tolerant of People Who Choose to Live According to Their Own Moral Standards"
label define Standardsown ///
0 "0 Agree strongly" 1 "1 Agree somewhat" ///
2 "2 Neither agree nor disagree" 3 "3 Disagree somewhat" 4 "4 Disagree strongly"
label values Standards Standardsown

****************
*Let us now create a new dataset incorporating only our analysis variables*

*Note: We also preserve the ANES Cumulative File's survey year* 
*variable, VCF0004, which we will require to complete our empirical analysis*

*Note: We of course preserve our variable indicating case identification*
*numbers, VCF0006*
****************

****************
keep VCF0004 VCF0006 White-Standards
****************

****************
*We will now save these recoded data as a Stata data file entitled*
*"Analyzing Partisan Change Using the ANES Cumulative File, 1988-2012 ANES.dta"
****************

*We then open the 2016 ANES and recode it before appending the resulting*
*analysis dataset to the recoded ANES Cumulative File dataset in order to* 
*incorporate the 2016 ANES into the ANES Cumulative File*

*The 2016 ANES source dataset is saved as the following Stata data* 
*file: "2016 ANES.dta"*

*The code used to recode the 2016 ANES is saved as a separate Stata do file*
*entitled "Recoding the 2016 ANES.do"

*The recoded 2016 ANES dataset that we will append to the recoded* 
*ANES Cumulative File is saved as a Stata data file entitled* 
*"Recoded 2016 ANES Data.dta"*
****************

****************
*We now append the recoded 2016 ANES dataset to our recoded ANES Cumulative* 
*File to create our analysis dataset
****************

append using "/Users/rnl17004/Documents/Documents/Co-authored Papers/Southern Partisan Change/Stata Data/Recoded 2016 ANES Data.dta"

*Check to ensure that the appending attempt was successful*

summarize

****************
*Create a time variable that will be interacted with core values and the*
*region variable in order to assess the potentially changing over time* 
*influence of egalitarianism on partisanship across regions*
*This three-way interaction will serve as the primary empirical relationship*
*of interest in the manuscript*

*Note: The time variable is an indicator of partisan polarization and* 
*begins in 1988 because 1988 was the first year in which the moral* 
*traditionalism battery was included on the ANES*
*Thus, the time variable takes a value of 0 in 1988 and 6 in 2016*

*Note: The time variable omits the year 1996 because the crucial racial*
*resentment battery used in this analysis was unfortunately and*
*inexplicably not asked in that year*

*Note: We first assign the value of 2016 to the ANES Cumulative File's survey*
*year variable, VCF0004, for all missing values, which in our recoded and* 
*appended dataset represent the year 2016*
****************

replace VCF0004 = 2016 if VCF0004 == .

*Time*

gen Time = .
replace Time = 0 if VCF0004 == 1988
replace Time = 1 if VCF0004 == 1992
replace Time = 2 if VCF0004 == 2000
replace Time = 3 if VCF0004 == 2004
replace Time = 4 if VCF0004 == 2008
replace Time = 5 if VCF0004 == 2012 
replace Time = 6 if VCF0004 == 2016

****************
*Complete the retrospective economic evaluations variable coding*

*Note: We complete this coding now because the interaction term requires*
*that we interact the economic retrospective evaluations constitutive term*
*with the newly created time variable*

*Note: This variable is coded 0, indicating Republican control of the* 
*White House, in 1988, 1992, 2004 and 2008*
*This variable is thus coded 1, indicating Democratic control of the* 
*White House, in 1996, 2000 and 2012*
****************

*Democratic incumbent president*

gen Dempres= .
replace Dempres = 0 if VCF0004 == 1988
replace Dempres = 0 if VCF0004 == 1992
replace Dempres = 0 if VCF0004 == 2004
replace Dempres = 0 if VCF0004 == 2008
replace Dempres = 1 if VCF0004 == 2000
replace Dempres = 1 if VCF0004 == 2012
replace Dempres = 1 if Time == 6
label var Dempres "Democratic Incumbent President"
label define Democraticpresident ///
0 "Republican president" 1 "Democratic president"
label values Dempres Democraticpresident

****************
*Create a multiplicative interaction term involving the retrospective*
*economic evaluations variable and the Democratic incumbent president variable*
*that will be included in our main regression models*

*Note: The constitutive economic retrospective evaluations term can now*
*be interpreted as the association between economic assessments and partisanship*
*when a Republican is the incumbent president, and the interaction term*
*captures the same relationship when a Democrat is the incumbent president*
*The constitutive Democratic president term is thus the estimated relationship* 
*between economic evaluations and partisanship when an individual
*believes that the economy has worsened and a Democrat occupies the White House*
****************

*Create an interaction term to capture the conditional effects* 
*of presidential control on the relationship between retrospective economic* 
*evaluations and partisanship*

gen Retdem = Retrospective*Dempres

****************
*Create all scales that will be used in the empirical analyses*
****************

****************
*Create a racial resentment scale*
****************

alpha Conditionsblack Blacksspecial Blackstry Blacksgotless, detail item ///
generate (Racialresentmentscale)

*Recode the racial resentment scale from 0 to 1*

*Note: The variable is coded such that all primary predictors*
*of interest range from zero to one, enabling a clear comparison* 
*of effects*

table Racialresentmentscale

replace Racialresentmentscale = Racialresentmentscale/4

****************
*Create a religiosity scale*
****************

alpha Biblit Churchattend, detail item generate(Religiosity)

****************
*Create an egalitarianism scale constructed from the four individual*
*egalitarianism indicators*
****************

*Egalitarianism*

alpha Equalopp Unequal Lessequal Fewer, ///
detail item generate (Egalitarianismscale)

*Recode the egalitarianism scale to range from 0 to 1*

replace Egalitarianismscale = Egalitarianismscale/4

*Note: The variable is coded such that all primary predictors*
*of interest range from zero to one, enabling a clear comparison* 
*of effects*

****************
*Create a moral traditionalism scale constructed from the four individual* 
*moral traditionalism indicators*
****************

*Moral traditionalism*

alpha Lifestyles Changing Family Standard, ///
detail item generate (Moralityscale) 

*Recode the moral traditionalism scale to range from 0 to 1*

replace Moralityscale = Moralityscale/4

*Note: The variable is coded such that all primary predictors*
*of interest range from zero to one, enabling a clear comparison* 
*of effects*

****************
*We now save our fully recoded and appended analysis dataset as a Stata data*
*file entitled:*
*Analyzing Partisan Change in the South and Non-South, 1988-2016 ANES.dta"*
****************

****************
*Predict partisanship over time*
****************

*Note: The primary empirical analysis in this manuscript features*
*split sample regressions to assess potential differences in the relationship*
*between core values, racial resentment and ideology, respectively, and* 
*partisanship over time among southerners and non-southerners*

*Note: The following code produces the estimates used to create article*
*Table 2 and Figure 1*

****************
*Southerners*
****************

*Note: The following four regression models generate results for southerners*
*only*

*Note: The "estimates store" command lines are used because we will plot*
*the estimated coefficient for the interaction terms between each of our*
*key independent variables and time for southerners and non-southerners*

****************
*Ideology*
****************

regress Partyid c.Time##c.Ideology Egalitarianismscale ///
Moralityscale Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1
estimates store Ideolsouth

****************
*Egalitarianism*
****************

regress Partyid c.Time##c.Egalitarianismscale Ideology Moralityscale ///
Racialresentmentscale Religiosity Retrospective Retdem ///
Dempres Gender Age Education Income if South == 1
estimates store Egalsouth

****************
*Moral traditionalism*
****************

regress Party c.Time##c.Moralityscale Ideology Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1
estimates store Moralsouth

****************
*Racial resentment*
****************

regress Party c.Time##c.Racialresentmentscale Ideology Egalitarianismscale ///
Moralityscale Religiosity Retrospective Retdem Dempres Gender Age Education ///
Income if South == 1
estimates store Racesouth

****************
*Non-southerners*
****************

*Note: The following four regression models generate results* 
*for non-southerners only*

****************
*Ideology*
****************

regress Partyid c.Time##c.Ideology Egalitarianismscale Moralityscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0
estimates store Ideolnonsouth

****************
*Egalitarianism*
****************

regress Partyid Ideology c.Time##c.Egalitarianismscale Moralityscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0
estimates store Egalnonsouth

****************
*Moral traditionalism*
****************

regress Partyid Ideology c.Time##c.Moralityscale Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0
estimates store Moralnonsouth

****************
*Racial resentment*
****************

regress Partyid Ideology c.Time##c.Racialresentmentscale Moralityscale ///
Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0
estimates store Racenonsouth

****************
*Note: We resave the dataset adding these newly stored estimates from the*
*preceding analysis*
****************

*Generate a coefficient plot to showcase the over time relationship between*
*each key independent variable and partisanship over time across regions*

*The following code uses the previous estimate to produce manuscript Figure 1*

*Many thanks are owed to Shane P. Singh for sharing this code with us!*
****************

local times = char(215)
coefplot (Ideolsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Ideology) offset(-.1)) ///
(Ideolnonsouth, mlcolor(blue) mfcolor(white) msymbol(O) /// 
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Ideology) offset(.1)) ///
(Egalsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Egalitarianismscale) offset(-.1)) ///
(Egalnonsouth,  mlcolor(blue) mfcolor(white) msymbol(O) /// 
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Egalitarianismscale) offset(.1)) ///
(Moralsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Moralityscale) offset(-.1)) ///
(Moralnonsouth, mlcolor(blue) mfcolor(white) msymbol(O) ///
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Moralityscale) offset(.1)) ///
(Racesouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Racialresentmentscale) offset(-.1)) ///
(Racenonsouth, mlcolor(blue) mfcolor(white) msymbol(O) ///
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Racialresentmentscale) offset(.1)), ///	
level(95) scheme(s1color) grid(none) xline(0, lcolor(black) lpattern(dash)) ///
xtitle("Coefficient estimate") ylabel(1 "Ideology X Time" ///
2 "Egalitarianism X Time" 3 "Moral traditionalism X Time" ///
4 "Racial resentment X Time")  ///
legend(order(2 "Southerners" 4 "Non-Southerners") rows(1) size(medsmall)) ///
xsize(7.5)  subtitle(, fcolor(dimgray)) drop(_cons) 

****************
*Predict Partisanship Using Three-Way Interactions*
****************

*Note: The following supplemental empirical analysis features three-way*
*interactions to assess potential differences in the relationship*
*between core values and predispositions, respectively, and partisanship* 
*over time among southerners and non-southerners*

*In other words, we now interact the ideology, egalitarianism,* 
*moral traditionalism and racial resentment variables, respectively, with both* 
*time* and region in order to examine region's conditional effect on these* 
*variables' relationship to partisanship over time*

*Note: The following code produces estimates used to create supplemental*
*online appendix Table A3 and manuscript Figures 2, 3, 4 and 5*

****************
*Ideology*
****************

regress Partyid c.Time##c.Ideology##i.South Racialresentmentscale ///
Moralityscale Egalitarianismscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education Income

****************
*Egalitarianism*
****************

regress Partyid c.Time##c.Egalitarianismscale##i.South Ideology ///
Moralityscale Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income 

****************
*Moral traditionalism*
****************

regress Partyid c.Time##c.Moralityscale##i.South Ideology Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective Retdem Dempres Gender ///
Age Education Income

****************
*Racial resentment*
****************

regress Partyid c.Time##c.Racialresentmentscale##i.South Ideology ///
Egalitarianismscale Moralityscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education Income 

****************
*Religiosity*
****************

regress Partyid Ideology c.Time##c.Religiosity##i.South ///
Moralityscale Egalitarianismscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education Income 

****************
*Generate marginal effects plots for the four three-way interactions involving* 
*each of above variables, respectively, region and time*

*Note: We interact each of the ideology, egalitarianism, moral traditionalism* 
*and resentment racial resentment variables with both time and region* 
*to illustrate the differences in the over time relationship between*
*these variables and partisanship among southerners and non-southerners*
****************

****************
*Ideology*

*Note: The following code produces estimates used to create manuscript* 
*Figure 2*
****************

regress Partyid c.Time##c.Ideology##i.South Racialresentmentscale ///
Egalitarianismscale Moralityscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income 

margins, dydx(Ideology) at(c.Time=(0(.01)6) ///
South=(0(1)1))

marginsplot, recast(line) recastci(rspike) plot1opts(lcolor(black) /// 
lpattern(solid)) plot2opts(lcolor(black) lpattern(dash)) ///
ci1opts(color(navy) lwidth(vthin)) ///  
ci2opts(color(maroon) lwidth(vthin)) ///
xdimension(Time) aspectratio(.67) ///
legend(order(4 "Southerners" ///
3 "Non-southerners")) /// 
legend(pos(6)col(1)) legend(symysize(*.5)) legend(symxsize(*.5)) /// 
legend(size(small)) ///
graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
xlabel(0 "1988" 1 "1992" 2 "2000" 3 "2004" 4 "2008" 5 "2012" 6 "2016", ///
labsize(medsmall)) ///
xtitle("", size(medsmall)) ///
xscale(range(.9 6.1)) ///
ylabel (2.5(.5)5.0, labsize(medsmall) nogrid) ///
ytitle("M.E. of Ideology on Partisanship Conditioned on Region", /// 
size(small)) ///
title("")

****************
*Egalitarianism*

*Note: The following code produces estimates used to create manuscript* 
*Figure 4*
****************

regress Partyid c.Time##c.Egalitarianismscale##i.South Ideology ///
Moralityscale Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income

margins, dydx(Egalitarianismscale) at(c.Time=(0(.01)6) ///
South=(0(1)1))

marginsplot, recast(line) recastci(rspike) plot1opts(lcolor(black) /// 
lpattern(solid)) plot2opts(lcolor(black) lpattern(dash)) ///
ci1opts(color(navy) lwidth(vthin)) ///  
ci2opts(color(maroon) lwidth(vthin)) ///
xdimension(Time) aspectratio(.67) ///
legend(order(4 "Southerners" ///
3 "Non-southerners")) /// 
legend(pos(6)col(1)) legend(symysize(*.5)) legend(symxsize(*.5)) /// 
legend(size(small)) ///
graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
xlabel(0 "1988" 1 "1992" 2 "2000" 3 "2004" 4 "2008" 5 "2012" 6 "2016", ///
labsize(medsmall)) ///
xtitle("", size(medsmall)) ///
xscale(range(.9 6.1)) ///
ylabel (-.5(.5)2.0, labsize(medsmall) nogrid) ///
ytitle("M.E. of Egalitarianism on Partisanship Conditioned on Region", /// 
size(small)) ///
title("")

****************
*Moral traditionalism*

*Note: The following code produces estimates used to create manuscript* 
*Figure 5*
****************

regress Partyid c.Time##c.Moralityscale##i.South Ideology ///
Egalitarianismscale Racialresentmentscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education Income

margins, dydx(Moralityscale) at(c.Time=(0(.01)6) ///
South=(0(1)1))

marginsplot, recast(line) recastci(rspike) plot1opts(lcolor(black) /// 
lpattern(solid)) plot2opts(lcolor(black) lpattern(dash)) ///
ci1opts(color(navy) lwidth(vthin)) ///  
ci2opts(color(maroon) lwidth(vthin)) ///
xdimension(Time) aspectratio(.67) ///
legend(order(4 "Southerners" ///
3 "Non-southerners")) /// 
legend(pos(6)col(1)) legend(symysize(*.5)) legend(symxsize(*.5)) /// 
legend(size(small)) ///
graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
xlabel(0 "1988" 1 "1992" 2 "2000" 3 "2004" 4 "2008" 5 "2012" ///
6 "2016", ///
labsize(medsmall)) ///
xtitle("", size(medsmall)) ///
xscale(range(.9 6.1)) ///
ylabel (-.5(.5)1.5, labsize(medsmall) nogrid) ///
ytitle("M.E. of Moral Traditionalism Conditioned on Region", /// 
size(small)) ///
title("")

****************
*Racial resentment*

*Note: The following code produces estimates used to create manuscript* 
*Figure 3*
****************

regress Partyid c.Time##c.Racialresentmentscale##i.South Ideology ///
Moralityscale Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income 

margins, dydx(Racialresentmentscale) at(c.Time=(0(1)6) ///
South=(0(1)1))

marginsplot, recast(line) recastci(rline) plot1opts(lcolor(black) /// 
lpattern(solid)) plot2opts(lcolor(black) lpattern(dash)) ///
ci1opts(color(navy) lwidth(vthin)) ///  
ci2opts(color(maroon) lwidth(vthin)) ///
xdimension(Time) aspectratio(.67) ///
legend(order(4 "Southerners" ///
3 "Non-southerners")) /// 
legend(pos(6)col(1)) legend(symysize(*.5)) legend(symxsize(*.5)) /// 
legend(size(small)) ///
graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
xlabel(0 "1988" 1 "1992" 2 "2000" 3 "2004" 4 "2008" 5 "2012" 6 "2016", ///
labsize(medsmall)) ///
xtitle("", size(medsmall)) ///
xscale(range(.9 6.1)) ///
ylabel (-.5(.3)1, labsize(medsmall) nogrid) ///
ytitle("M.E. of Racial Resentment on Partisanship Conditioned on Region", /// 
size(small)) ///
title("")

****************
*Supporting Information*

*The following code produces estimates used to create tables and figures that*
*appear in the supplemental online appendix*
****************

****************
*Calculate descriptive statistics for all analysis variables*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A1*
****************

summarize

****************
*Calculate descriptive statistics for key analysis variables, namely, ideology,*
*egalitarianism, moral traditionalism and racial resentment, across regions*
*and time*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A2*

*Note: The "ttest" command tests whether the mean difference for each variable*
*across regions is statistically significant
****************

****************
*Ideology*
****************

*Calculate the mean for the ideology variable in the South and non-South* 
*in 1988, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 0

*Calculate the mean for the ideology variable in the South and non-South* 
*in 1992, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 1

*Calculate the mean for the ideology variable in the South and non-South* 
*in 2000, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 2

*Calculate the mean for the ideology variable in the South and non-South* 
*in 2004, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 3

*Calculate the mean for the ideology variable in the South and non-South* 
*in 2008, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 4
 
*Calculate the mean for the ideology variable in the South and non-South* 
*in 2012, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 5

*Calculate the mean for the ideology variable in the South and non-South* 
*in 2016, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Ideology, by(South), if Time == 6

****************
*Egalitarianism*
****************

*Calculate the mean for the egalitarianism variable in the South and* 
*non-South in 1988, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 0

*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 1992, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 1

*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 2000, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 2

*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 2004, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 3

*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 2008, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 4
 
*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 2012, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 5

*Calculate the mean for the Egalitarianismscale variable in the South and* 
*non-South in 2016, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Egalitarianismscale, by(South), if Time == 6

****************
*Moral traditionalism*
****************

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 1988, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 0

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 1992, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 1

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 2000, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 2

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 2004, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 3

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 2008, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 4
 
*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 2012, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 5

*Calculate the mean for the moral traditionalism variable in the South and* 
*non-South in 2016, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Moralityscale, by(South), if Time == 6

****************
*Racial resentment*
****************

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 1988, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 0

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 1992, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 1

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 2000, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 2

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 2004, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 3

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 2008, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 4
 
*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 2012, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 5

*Calculate the mean for the racial resentment variable in the South and* 
*non-South in 2016, as well as test whether the mean difference across regions* 
*is statistically significant*

ttest Racialresentmentscale, by(South), if Time == 6

****************
*Calculate the mean egalitarianism scale value by party conditioned on region*
*for each analysis year*

*Note: Values of the partisanship variable lower than 3, or pure* 
*independents, will be coded as self-identified Democrats for the purpose*
*of this analysis*
*Likewise, all values higher than 3 will be coded as self-identified*
*Republicans*

*Note: The following code produces estimates used to create supplemental online*
*appendix Figure A1*
****************

****************
*Southerners*
****************

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 1988*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 0

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 1988*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 0

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 1992*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 1

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 1992*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 1

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 2000

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 2

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 2000*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 2

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 2004*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 3

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 2004*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 3

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 2008*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 4

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 2008*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 4

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 2012*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 5

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 2012*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 5

*Calculate the mean egalitarianism scale value among southern Democrats*
*in 2016*

sum Egalitarianismscale if Partyid < 3 & South == 1 & Time == 6

*Calculate the mean egalitarianism scale value among southern Republicans*
*in 2016*

sum Egalitarianismscale if Partyid > 3 & South == 1 & Time == 6

****************
*Non-southerners*
****************

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 1988*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 0

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 1988*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 0

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 1992*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 1

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 1992*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 1

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 2000*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 2

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 2000*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 2

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 2004*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 3

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 2004*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 3

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 2008*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 4

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 2008*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 4

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 2012*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 5

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 2012*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 5

*Calculate the mean egalitarianism scale value among non-southern Democrats*
*in 2016*

sum Egalitarianismscale if Partyid < 3 & South == 0 & Time == 6

*Calculate the mean egalitarianism scale value among non-southern Republicans*
*in 2016*

sum Egalitarianismscale if Partyid > 3 & South == 0 & Time == 6

****************
*Create a line graph plotting these egalitarianism mean values conditioned on*
*party and region*

*Note: The estimates generated immediately above are saved as a Stata data* 
*file entitled: "Egalitarianism Mean Values by Party Conditioned on Region and Year (1988-2016).dta"*

*Note: Again, the following line graph represents supplemental online appendix* 
*Figure A1*
****************

twoway  (line DemsEST n in 1/7, lcolor(navy) lpattern(solid) /// 
		legend(order(1 "Southern Democrats" 2 "Non-southern Democrats" ///
		3 "Southern Republicans" 4 "Non-southern Republicans")) /// 
        legend(pos(6)col(1)) /// 
        legend(size(small))) ///
		(line DemnsEST n in 1/7, lcolor(green) lpattern(dash)) ///
		(line RepsEST n in 1/7, lcolor(black) lpattern(dot)) /// 
		(line RepnsEST n in 1/7, lcolor(maroon) lpattern(longdash)), ///
	  	graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
	    plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
	  	aspectratio(.67) ///
	  	xlabel(1 "1988" 2 "1992" 3 "2000" 4 "2004" 5 "2008" ///
		6 "2012" 7 "2016", /// 
	  	labsize(medsmall)) ///
	    xtitle(" ", size(medsmall)) ///
	  	ylabel(.25(.05).5, labsize(medsmall) nogrid) ///
	  	ytitle("Mean Egalitarianism Value", size(medsmall))		

****************
*Estimate changes in the over time correlation between egalitarianism*
*and partisanship in the South and non-South, 1988-2016*

*Note: We estimate these correlations in order to evaluate the "first-order"*
*relationship between egalitarianism and partisanship over time across regions*

*Note: The following code produces estimates used to create supplemental online*
*appendix Figure A2*
****************

*Estimate the correlation between egalitarianism and partisanship in the*
*non-south in 1988*

corrci Egalitarianismscale Partyid if Time == 0 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 1992*

corrci Egalitarianismscale Partyid if Time == 1 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2000*

corrci Egalitarianismscale Partyid if Time == 2 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2004*

corrci Egalitarianismscale Partyid if Time == 3 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2008*

corrci Egalitarianismscale Partyid if Time == 4 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2012*

corrci Egalitarianismscale Partyid if Time == 5 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2016*

corrci Egalitarianismscale Partyid if Time == 6 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*south in 1988*

corrci Egalitarianismscale Partyid if Time == 0 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 1992*

corrci Egalitarianismscale Partyid if Time == 1 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2000*

corrci Egalitarianismscale Partyid if Time == 2 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2004*

corrci Egalitarianismscale Partyid if Time == 3 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2008*

corrci Egalitarianismscale Partyid if Time == 4 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2012*

corrci Egalitarianismscale Partyid if Time == 5 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2016*

corrci Egalitarianismscale Partyid if Time == 6 & South == 1

****************
*Present the correlations calculated above graphically via a correlation plot*

*Note: The estimates generated immediatley above are saved as a Stata data* 
*file titled: "Correlation between Egalitarianism and Partisanship (1988-2016 ANES)"*

*Note: Again, the following correlation plot represents supplemental online*
*appendix Figure A2*
****************

twoway  (scatter NonsouthEST n in 1/14, mcolor(black) ///
		msymbol(circle_hollow) /// 
        mfcolor(white) msize(medium)) /// 
        (rspike NonsouthLOW NonsouthHIGH n in 1/14, vertical lcolor(black) /// 
        lwidth(thin) ///
		legend(order(3 "South" 1 "Non-south")) /// 
        legend(pos(6)col(1)) /// 
        legend(size(small))) ///
		(scatter SouthEST n in 1/14, mcolor(black) msymbol(circle) /// 
		msize(medium)) ///
		(rspike SouthLOW SouthHIGH n in 1/14, /// 
		vertical lcolor(black) lwidth(thin)), ///
	  	graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
	    plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
	  	aspectratio(.67) ///
	  	xlabel(1.5 "1988" 3.5 "1992" 5.5 "2000" 7.5 "2004" 9.5 "2008" ///
		11.5 "2012" 13.5 "2016", /// 
	  	labsize(medsmall)) ///
	    xtitle(" ", size(medsmall)) ///
	  	ylabel(-.1(.1).6, labsize(medsmall) nogrid) ///
	  	ytitle("Correlation", size(medsmall))

****************
*Estimate changes in the over time correlation between racial resentment*
*and partisanship in the South and non-South, 1988-2016*

*Note: We estimate these correlations in order to evaluate the "first-order"*
*relationship between racial resentment and partisanship over time* 
*across regions*

*Note: The following code produces estimates used to create supplemental online*
*appendix Figure A3*
****************

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 1988*

corrci Racialresentmentscale Partyid if Time == 0 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 1992*

corrci Racialresentmentscale Partyid if Time == 1 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2000*

corrci Racialresentmentscale Partyid if Time == 2 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2004*

corrci Racialresentmentscale Partyid if Time == 3 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2008*

corrci Racialresentmentscale Partyid if Time == 4 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2012*

corrci Racialresentmentscale Partyid if Time == 5 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*non-south in 2016*

corrci Racialresentmentscale Partyid if Time == 6 & South == 0

*Estimate the correlation between racial resentment and partisanship in the*
*south in 1988*

corrci Racialresentmentscale Partyid if Time == 0 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 1992*

corrci Racialresentmentscale Partyid if Time == 1 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2000*

corrci Racialresentmentscale Partyid if Time == 2 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2004*

corrci Racialresentmentscale Partyid if Time == 3 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2008*

corrci Racialresentmentscale Partyid if Time == 4 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2012*

corrci Racialresentmentscale Partyid if Time == 5 & South == 1

*Estimate the correlation between racial resentment and partisanship in the*
*south in 2016*

corrci Racialresentmentscale Partyid if Time == 6 & South == 1

****************
*Present the correlations calculate above graphically via a correlation plot*

*Note: The estimates generated immediately above are saved as a Stata data* 
*file titled:* 
*Correlation between Racial Resentment and Partisanship (1988-2016 ANES)"*

*Note: Again, the following correlation plot represents supplemental online*
*appendix Figure A3*
****************

twoway  (scatter NonsouthEST n in 1/14, mcolor(black) ///
		msymbol(circle_hollow) /// 
        mfcolor(white) msize(medium)) /// 
        (rspike NonsouthLOW NonsouthHIGH n in 1/14, vertical lcolor(black) /// 
        lwidth(thin) ///
		legend(order(3 "South" 1 "Non-south")) /// 
        legend(pos(6)col(1)) /// 
        legend(size(small))) ///
		(scatter SouthEST n in 1/14, mcolor(black) msymbol(circle) /// 
		msize(medium)) ///
		(rspike SouthLOW SouthHIGH n in 1/14, /// 
		vertical lcolor(black) lwidth(thin)), ///
	  	graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
	    plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
	  	aspectratio(.67) ///
	  	xlabel(1.5 "1988" 3.5 "1992" 5.5 "2000" 7.5 "2004" 9.5 "2008" ///
		11.5 "2012" 13.5 "2016", /// 
	  	labsize(medsmall)) ///
	    xtitle(" ", size(medsmall)) ///
	  	ylabel(-.1(.1).6, labsize(medsmall) nogrid) ///
	  	ytitle("Correlation", size(medsmall))
		
****************
*We will now recreate the coefficient plot featured in manuscript Table 1, but*
*this time we will also estimate the relationship between religiosity*
*and partisanship over time among southerners and non-southerners*

*Note: Thus, we will create interaction terms involving religiosity and*
*time in two new split-sample regressions, and then we will store estimates*
*from those models*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A5 and Figure A5*
****************

****************
*Southerners*
****************

regress Partyid c.Time##c.Religiosity Ideology Egalitarianismscale ///
Moralityscale Racialresentment Retrospective Retdem Dempres Gender Age ///
Education Income if South == 1
estimates store Religionsouth

****************
*Non-southerners*
****************

regress Partyid c.Time##c.Religiosity Ideology Egalitarianismscale ///
Moralityscale Racialresentment Retrospective Retdem Dempres Gender Age ///
Education Income if South == 0
estimates store Religionnonsouth

****************
*Note: We resave the dataset adding these newly stored estimates from the*
*preceding estimates*
****************

****************
*Generate a coefficient plot to showcase the over time relationship between*
*each key independent variable and partisanship over time across regions*

*Note: Again, the following code produces estimates used to create supplemental* 
*online appendix Figure A5*
****************

local times = char(215)
coefplot (Ideolsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Ideology) offset(-.1)) ///
(Ideolnonsouth, mlcolor(blue) mfcolor(white) msymbol(O) /// 
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Ideology) offset(.1)) ///
(Egalsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Egalitarianismscale) offset(-.1)) ///
(Egalnonsouth,  mlcolor(blue) mfcolor(white) msymbol(O) /// 
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Egalitarianismscale) offset(.1)) ///
(Moralsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Moralityscale) offset(-.1)) ///
(Moralnonsouth, mlcolor(blue) mfcolor(white) msymbol(O) ///
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Moralityscale) offset(.1)) ///
(Racesouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Racialresentmentscale) offset(-.1)) ///
(Racenonsouth, mlcolor(blue) mfcolor(white) msymbol(O) ///
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Racialresentmentscale) offset(.1)) ///	
(Religionsouth, mcolor(red) ciopts(lcolor(red*.50)) ///
keep(c.Time#c.Religiosity) offset(-.1)) ///
(Religionnonsouth, mlcolor(blue) mfcolor(white) msymbol(O) /// 
ciopts(lcolor(blue*.50)) ///
keep(c.Time#c.Religiosity) offset(-.1)), ///
level(95) scheme(s1color) grid(none) xline(0, lcolor(black) lpattern(dash)) ///
xtitle("Coefficient estimate") ylabel(1 "Ideology X Time" ///
2 "Egalitarianism X Time" 3 "Moral traditionalism X Time" ///
4 "Racial resentment X Time" 5 "Religiosity X Time")  ///
legend(order(2 "Southerners" 4 "Non-Southerners") rows(1) size(medsmall)) ///
xsize(7.5) subtitle(, fcolor(dimgray)) drop(_cons) 

****************
*Let us now specify a fully interactive regression model for our Southern* 
*sample featuring all of our two-way interactions*
*Thus, we will include in the models interactions between time and ideology,*
*egalitarianism, moral traditionalism and racial resentment, respectively,*
*in split-sample regressions predicting over time partisan change among*
*Southerners and non-Southerners*

*Note: We will perform an F-test (i.e., a Wald test) to determine if the* 
*interaction terms improve model fit significantly* 
*That is, we will test whether the interaction terms are jointly equal to zero*

*Note: This code does not correspond to any manuscript result, but it is*
*instructive analysis, and thus we include it in this do file*
****************

****************
*Southerners*
****************

regress Partyid c.Time##c.Ideology c.Time##c.Egalitarianismscale ///
c.Time##c.Moralityscale c.Time##c.Racialresentmentscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education ///
Income if South == 1

test c.Time#c.Ideology c.Time#c.Egalitarianismscale ///
c.Time#c.Moralityscale c.Time#c.Racialresentmentscale

****************
*Let us also now construct a more fully specified and theoretically enriched* 
*interactive regression model for our Southern sample featuring*
*two-way interactions between time and egalitarianism and racial resentment,* 
*respectively*

*Note: We specify this model because of the distinct possibility that racial*
*resentment's effects will wash away those of egalitarianism in our model of*
*southerners' partisan change*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A4 and Figure A4*
****************

regress Partyid Ideology c.Time##c.Egalitarianismscale ///
c.Time##c.Racialresentmentscale Moralityscale Religiosity ///
Retrospective Retdem Dempres Gender Age Education ///
Income if South == 1

local times = char(215)
coefplot, drop(_cons Time Ideology Egalitarianismscale Moralityscale ///
Racialresentmentscale ///
Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income) ///
coeflabels(c.Time#c.Egalitarianismscale = "Time X Egalitarianism" /// 
c.Time#c.Racialresentmentscale = "Time X Racial resentment", ///
labsize(medsmall)) ///
mlcolor(red) mfcolor(red) msymbol(O) ///
ciopts(lcolor(red*.50)) ///
level(95)scheme(s1color) grid(none) xline(0, lcolor(black) lpattern(dash))

****************
*Specify a fully interactive model incorporating every three-way*
*interaction*

*Thus the model specified below incorporates interactions between time,*
*region and each key independent variable: ideology, egalitarianism,*
*moral traditionalism and racial resentment*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A6*
****************

regress Party c.Time##c.Ideology##i.South /// 
c.Time##c.Egalitarianism##i.South c.Time##c.Moralityscale##i.South ///
c.Time##c.Racialresentment##i.South Religiosity ///
Retrospective Retdem Dempres Gender Age Education Income 

****************
*Predict partisanship over time with partisanship operationalized as a dummy*
*variable*

*In order to ensure that our model appropriately captures a Republican*
*realignment, as opposed to the movement of Democrats into the independent*
*category, we will specify partisanship as a dummy variable in which*
*self-identified "strong" and "weak" Democrats are coded as 0 and "strong"*
*and "weak" Republicans are coded as 1*

*Note: We will use the newly constructed partisanship dummy variable* 
*to replicate the primary empirical analysis in this manuscript featuring* 
*split-sample regressions to assess potential differences in the relationship* 
*between core values, racial resentment and ideology, respectively, and* 
*partisanship over time among southerners and non-southerners*

*Note: We estimate the following models using logistic regression*
*given the dichotomous dependent variable*

*Note: The following code produces estimates used to create supplemental online*
*appendix Table A9
***************

****************
*Create the partisanship dummy variable*
****************

gen PIDdummy = .
replace PIDdummy = 0 if Partyid == 0
replace PIDdummy = 0 if Partyid == 1
replace PIDdummy = 1 if Partyid == 5
replace PIDdummy = 1 if Partyid == 6

****************
*Southerners*
****************

*Note: The following four regression models generate results for southerners*
*only*

****************
*Ideology*
****************

logit PIDdummy c.Time##c.Ideology Egalitarianismscale ///
Moralityscale Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1

****************
*Egalitarianism*
****************

logit PIDdummy c.Time##c.Egalitarianismscale Ideology Moralityscale ///
Racialresentmentscale Religiosity Retrospective Retdem ///
Dempres Gender Age Education Income if South == 1

****************
*Moral traditionalism*
****************

logit PIDdummy c.Time##c.Moralityscale Ideology Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1

****************
*Racial resentment*
****************

logit PIDdummy c.Time##c.Racialresentmentscale Ideology Egalitarianismscale ///
Moralityscale Religiosity Retrospective Retdem Dempres Gender Age Education ///
Income if South == 1

****************
*Non-southerners*
****************

*Note: The following four regression models generate results* 
*for non-southerners only*

****************
*Ideology*
****************

logit PIDdummy c.Time##c.Ideology Racialresentmentscale Moralityscale ///
Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0

****************
*Egalitarianism*
****************

logit PIDdummy Ideology c.Time##c.Egalitarianismscale Moralityscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0

****************
*Moral traditionalism*
****************

logit PIDdummy Ideology c.Time##c.Moralityscale Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0

****************
*Racial resentment*
****************

logit PIDdummy Ideology c.Time##c.Racialresentmentscale Moralityscale ///
Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0
****************

****************
*Predict partisanship over time with partisanship operationalized as a nominal*
*variable*

*In order to ensure that our model appropriately captures a Republican*
*realignment, as opposed to the movement of Democrats into the independent*
*category, we will specify partisanship as a nominal variable* 

*Rather than simply discarding information from the middle categories, this* 
*coding scheme allows us to model partisan defection from the Democratic* 
*Party to either the Independent category or to the Republican Party*

*We therefore operationalize partisanship here as a nominal variable for* 
*which individuals who self-identity as “strong Democrats” (1)* 
*or “Democrats” (2) on the traditional seven-point scale are coded as 1,* 
*individuals who self-identify as either “Independent-leaning Democrats” (3),* 
*“pure Independents” (4) or “Independent-leaning Republicans” (5) are coded* 
*as 2 and individuals who self-identify as “Republicans” (6)* 
*or “Strong Republicans” (7) are coded three*

*Note: We will use the newly constructed partisanship nominal variable* 
*to replicate the primary empirical analysis in this manuscript featuring* 
*split-sample regressions to assess potential differences in the relationship* 
*between core values, racial resentment and ideology, respectively, and* 
*partisanship over time among southerners and non-southerners*

*Note: The following code produces estimates used to create supplemental online*
*appendix Tables A10-A17*
***************

****************
*Create the partisanship nominal variable*
****************

gen PIDmnl = .
replace PIDmnl = 1 if Partyid == 0
replace PIDmnl = 1 if Partyid == 1
replace PIDmnl = 2 if Partyid == 2
replace PIDmnl = 2 if Partyid == 3
replace PIDmnl = 2 if Partyid == 4
replace PIDmnl = 3 if Partyid == 5
replace PIDmnl = 3 if Partyid == 6

****************
*Southerners*
****************

*Note: The following four regression models generate results for southerners*
*only*

****************
*Ideology*
****************

mlogit PIDmnl c.Time##c.Ideology Egalitarianismscale ///
Moralityscale Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1, base(1)

****************
*Egalitarianism*
****************

mlogit PIDmnl c.Time##c.Egalitarianismscale Ideology Moralityscale ///
Racialresentmentscale Religiosity Retrospective Retdem ///
Dempres Gender Age Education Income if South == 1, base(1)

****************
*Moral traditionalism*
****************

mlogit PIDmnl c.Time##c.Moralityscale Ideology Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 1, base(1)

****************
*Racial resentment*
****************

mlogit PIDmnl c.Time##c.Racialresentmentscale Ideology Egalitarianismscale ///
Moralityscale Religiosity Retrospective Retdem Dempres Gender Age Education ///
Income if South == 1, base (1)

****************
*Non-southerners*
****************

*Note: The following four regression models generate results* 
*for non-southerners only*

****************
*Ideology*
****************

mlogit PIDmnl c.Time##c.Ideology Racialresentmentscale Moralityscale ///
Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0, base (1)

****************
*Egalitarianism*
****************

mlogit PIDmnl Ideology c.Time##c.Egalitarianismscale Moralityscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0, base (1)

****************
*Moral traditionalism*
****************

mlogit PIDmnl Ideology c.Time##c.Moralityscale Egalitarianismscale ///
Racialresentmentscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0, base (1)

****************
*Racial resentment*
****************

mlogit PIDmnl Ideology c.Time##c.Racialresentmentscale Moralityscale ///
Egalitarianismscale Religiosity Retrospective ///
Retdem Dempres Gender Age Education Income if South == 0, base (1)

****************
*Estimate the conditional relationship between egalitarianism and partisanship* 
*separately for each analysis year, 1988-2016*

*Note: This analysis involves specifying seven separate regression models* 
*featuring multiplicative interaction models between egalitarianism and region*

*Note: The following code produces estimates used to create supplemental online*
*appendix Figure A8*
**************** 

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 0

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 1

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 2

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 3

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 4

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 5

regress Party Ideology c.Egalitarianismscale##i.South Moralityscale ///
Racialresentmentscale Religiosity Retrospective Gender Age Education Income ///
if Time == 6

****************
*Create a marginal effects plot to showcase the over time relationship between*
*each key independent variable and partisanship over time across regions*

*Note: The estimated generated in the regression models above are saved as the*
*following Stata data file:*
*"Coefficient for the Interaction Between Egalitarianism and Time, 1988-2016 ANES.dta*

*Note: Again, the following code produces estimates used to create supplemental* 
*online appendix Figure A8*
****************

twoway  (scatter EST n in 1/7, mcolor(black) ///
		msymbol(circle_hollow) /// 
        mfcolor(white) msize(medium)) /// 
        (rspike LOW HIGH n in 1/7, vertical lcolor(black) /// 
        lwidth(thin)), ///
	  	graphregion(fcolor(white)) graphregion(lpattern(blank)) ///
	    plotregion(lcolor(black))graphregion(margin(medsmall)) /// 
	  	aspectratio(.67) ///
		yline(0, lpattern(dash) lcolor(black)) ///
	  	xlabel(1 "1988" 2 "1992" 3 "2000" 4 "2004" 5 "2008" ///
		6 "2012" 7 "2016", /// 
	  	labsize(medsmall)) ///
		legend (off) ///
	    xtitle(" ", size(medsmall)) ///
	  	ylabel(-3.0(1)2.0, labsize(medsmall) nogrid) ///
	  	ytitle("Coefficient", size(medsmall))
